package com.becca.cake.dao.order;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.address.BaiduRangeParamModel;
import com.becca.cake.model.logistic.LogisticStatusModel;
import com.becca.cake.model.order.GoodOrderModel;
import com.becca.cake.model.order.OrderDetailsModel;
import com.becca.cake.model.order.OrderExcelModel;
import com.becca.cake.model.order.OrderModel;
import com.becca.cake.model.order.OrderRefundsModel;
import com.becca.cake.model.order.OrdersTodayModel;
import com.becca.cake.model.users.UserPaymentsModel;

/**
 * 订单管理Dao接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年5月18日 下午2:46:20
 */
@Repository
public interface OrderDAO {
    /**
     * 查询订单数据
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<OrderModel> selectOrders(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询订单总记录数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectOrdersCount(Map<String, Object> map) throws DataAccessException;

    /**
    * 修订订单信息
    * @author yellow
    * @param orderModel
    * @throws DataAccessException
    */
    void updateOrder(OrderModel orderModel) throws DataAccessException;

    /**
     * 根据orderId获取对应订单对象
     * @param orderId
     * @return
     * @throws DataAccessException
     */
    OrderModel findOrderById(Integer orderId) throws DataAccessException;

    /**
     * 跟据订单号查询订单详情
     * @param orderId
     * @return
     * @throws DataAccessException
     */
    List<OrderDetailsModel> selectDetailsByOrderId(Integer orderId) throws DataAccessException;

    /**
     * 根据ID查询订单信息
     * @param orderId
     * @return
     * @throws DataAccessException
     */
    OrderModel selectOrderById(Integer orderId) throws DataAccessException;

    /**
     * 修改订单状态信息
     * @param orderModel
     * @throws DataAccessException
     */
    void updateOrderStatus(OrderModel orderModel) throws DataAccessException;

    /**
     * 添加物流信息
     * @param logisticStatusModel
     * @throws DataAccessException
     */
    void addLogisticStatus(LogisticStatusModel logisticStatusModel) throws DataAccessException;

    /**
     * 修改物流单号
     * @param orderModel
     * @throws DataAccessException
     */
    void updateOrderLogisticNo(OrderModel orderModel) throws DataAccessException;

    /**
     * 查询物流状态
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<LogisticStatusModel> queryLogisticStatus(Map<String, Object> map)
                                                                          throws DataAccessException;

    /**
     * 查询物流状态总数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long queryLogisticStatusCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询确认订单总记录数
     * @param map
     * @return
     * @throws DataAccessException
     */
    int selcectOrderConfrimCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询打印的订单信息
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<OrderModel> selectPrintThermalOrder(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询商品对应的全部配件信息
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<OrderDetailsModel> selectOrderDetailFixings(Map<String, Object> map)
                                                                             throws DataAccessException;

    /**
     * 查询热敏打印商品详情信息
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<OrderDetailsModel> selectOrderDetailByOrderId(Map<String, Object> map)
                                                                               throws DataAccessException;

    /**
     * 交接单打印：查询交接订单列表
     * @param orderIds
     * @return
     * @throws DataAccessException
     */
    List<OrderModel> selectHandOverOrders(@Param("orderIds") String orderIds)
                                                                             throws DataAccessException;

    /**
     * 交接单打印：查询交接详情列表
     * @return
     * @throws DataAccessException
     */
    List<OrderDetailsModel> selectHandOverOrderDetails(Integer orderId) throws DataAccessException;

    /**
     * 订单详情 ：导出excel
     * 
     * @param orderId
     * @return
     * @throws DataAccessException
     */
    List<OrderExcelModel> selectOrderExcelModel(@Param("orderIds") String orderIds)
                                                                                   throws DataAccessException;

    /**
     * 修改物流信息
     * @param map
     * @throws DataAccessException
     */
    void updateOrderLogisticsMessage(Map<String, Object> map) throws DataAccessException;

    /**
     * 拒收订单
     * @param map
     * @throws DataAccessException
     */
    void updRefuseReceiveOrder(Map<String, Object> map) throws DataAccessException;

    /**
     * 每天的订单明细
     * @param preDayTime
     * @param nowDayTime
     * @return
     * @throws DataAccessException
     */
    List<OrderModel> selectDayOrders(Map<String, Object> paramMap) throws DataAccessException;

    /**
     * 新建订单对象
     * @param orderModel
     * @throws DataAccessException
     */
    void insertOrder(OrderModel orderModel) throws DataAccessException;

    /**
     * 新建订单详情对象
     * @param orderDetailsModel
     * @throws DataAccessException
     */
    void insertOrderDetail(OrderDetailsModel orderDetailsModel) throws DataAccessException;

    /**
     * 设置订单编码
     * @param paramMap
     * @throws DataAccessException
     */
    void updateOrderCode(Map<String, Object> paramMap) throws DataAccessException;

    /**
     * 添加商品详情信息
     * @param OrderDetailList
     * @throws DataAccessException
     */
    void insertOrderDetails(Map<String, Object> orderDetailMap) throws DataAccessException;

    /**
     * 添加支付流水记录
     * @param paymentsModel
     */
    int addUserPayments(UserPaymentsModel paymentsModel);

    /**
     * 查询全部有效订单地址订单
     * @param paramMap
     * @return
     * @throws DataAccessException
     */
    List<OrderModel> selectAllOrderAddressPoint(Map<String, Object> paramMap)
                                                                             throws DataAccessException;

    /**
     * 查询商品尺寸
     * @return
     * @throws DataAccessException
     */
    List<GoodOrderModel> selectGoodsPrize(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询商品尺寸总数
     * @return
     * @throws DataAccessException
     */
    Long selectGoodsPrizeCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询全部经纬度数据
     * @param paramerMap
     * @return
     */
    List<BaiduRangeParamModel> selectBaiduRangeInfoList(Map<String, Object> paramerMap);

    /**
     * 新建订单退款对象
     * @param OrderRefundsModel
     * @throws DataAccessException
     */
    void insertOrderRefundsModel(OrderRefundsModel orderRefundsModel) throws DataAccessException;

    /**
     * 查询全部退款数据
     * @param paramerMap
     * @return
     */
    List<OrderRefundsModel> selectOrderRefundsList(Map<String, Object> paramerMap)
                                                                                  throws DataAccessException;

    /**
     * 查询全部退款总数
     * @param paramerMap
     * @return
     */
    Long selectOrderRefundsCount(Map<String, Object> paramerMap) throws DataAccessException;

    /**
     * 修改订单退款状态
     * @param orderRefundsModel
     * @return
     */
    void updateOrderRefundsStatus(OrderRefundsModel orderRefundsModel) throws DataAccessException;

    /**
     * 根据ID查询订单信息
     * @param id
     * @return
     * @throws DataAccessException
     */
    OrderRefundsModel selectOrderRefundsById(Integer id) throws DataAccessException;

    /**
     * 试吃交接单打印：查询交接订单列表
     * @param orderIds
     * @return
     * @throws DataAccessException
     */
    List<OrderModel> selectHandOverOrdersComfirmed(@Param("orderIds") String orderIds)
                                                                                      throws DataAccessException;

    /**
     * 试吃交接单打印：查询交接详情列表
     * @return
     * @throws DataAccessException
     */
    List<OrderDetailsModel> selectHandOverOrderComfirmedDetails(Map<String, Object> map)
                                                                                        throws DataAccessException;

    /**
     * 今日达订单数据
     * @param map
     * @return
     * @throws Exception
     */
    List<OrdersTodayModel> selectTodayOrders(Map<String, Object> map) throws ServiceException;

    /**
     * 今日达订单总记录数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectTodayOrdersCount(Map<String, Object> map) throws ServiceException;

}
